package com.jgdt.config;

import com.jgdt.deploy.DeployService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.RouterFunctions;
import org.springframework.web.reactive.function.server.ServerResponse;

/**
 * @author wangbin
 */
@Configuration(proxyBeanMethods = false)
public class RouterConfig {
    @Bean
    public RouterFunction<ServerResponse> deployApis(DeployService deployService) {
        return RouterFunctions.route()
                .GET("/deploy", deployService::list)
                .POST("/deploy", deployService::save)
                .DELETE("/deploy/{id}", deployService::delete)
                .build();
    }
}
